/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.javafxcodeparsers.objects;

import org.openide.util.lookup.AbstractLookup;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodeparsers.api.Parser;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodeparsers.main.MainParser;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodeparsers.tools.LocalLookupInitializer;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Application;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.ImportManager;

/**
 *
 * @author Admin
 */
public class ApplicationParser implements Parser{

    @Override
    public boolean canParse(String s) {
        return true;
    }

    @Override
    public Object parse(Object instructions, Object parent) {
        this.initialize();
        return null;
    }

   private Application application = new Application();
   /**
    * Just a convenience method - same as getApplication.getImportManager();
    * @return
    */
   public ImportManager getImportManager(){
       return this.application.getImportManager();
   }
   public Application getApplication(){
       return this.application;
   }
   
    @Override
    public boolean getProperContext(Class c) {
        if(c==MainParser.class)
            return true;
        else return false;
    }

    private AbstractLookup localLookup = null;

    public AbstractLookup getLocalLookup(){
        return this.localLookup;
    }
    //TODO : Grzegorz : figure out if localLookup should be changable after initialization
    //if so change this so that this sets InstanceContent and then localLookup
    private void initialize(){ 
        this.localLookup=LocalLookupInitializer.getMyLocalLookup(this.getClass());
    }
}
